<?php
namespace yan\hkecship\test;
use yan\hkecship\box\Item;
use yan\hkecship\box\Box;
use yan\hkecship\box\Packing;
class Test{
	public static function test(){
		$list = [
			[10, 20 , 30, 300],
			[30, 25 , 33, 320],
			[10, 40 , 10, 200],
			[25, 22 , 40, 380],
			[13, 28 , 38, 280],
			[40, 21 , 33, 500],
			[100, 50 , 68, 700],
			[50, 20 , 70, 350],
			[18, 50 , 60, 520],
			[25, 25 , 50, 330],
			[10, 50 , 22, 200],
			[40, 47 , 19, 400],
			[50, 28 , 71, 450],
			[21, 55 , 82, 420],
			[61, 76 , 93, 600],
			[71, 81 , 65, 550],
			[35, 62 , 41, 450],
			[52, 55 , 35, 400],
		];
		$packing = new Packing();
		$items = [];
		foreach ($list as $key => $val) {
			$packing->addItem($val[0], $val[1], $val[2], $val[3]);
		}
		usort($items, function($a, $b) {
		    return $a->getMax() - $b->getMax() > 0 ? 1 : -1;
		});
		$boxes = $packing->run();
		var_dump(count($boxes));
		echo "<br/>";
		var_dump($boxes[0]->getTotalWeight());
	}
}